package util;
import java.sql.Connection;
import java.sql.DriverManager;

/**
 * This class handles the database connection for all requests.
 * 
 * @author Josef Hardi
 *
 */
public class DBConnection {
   
	/**
	 * Creating the database connection.
	 * 
	 * @return DB connection
	 */
   public static Connection getConnection() {
	   
	   try {
			// get the connection to the MySQL database
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			String url = "jdbc:mysql://localhost/pub2search";
			Connection conn = DriverManager.getConnection(url, "root", "josejose");			
			return conn;
	   } 
	   catch (Exception e) {			
			e.printStackTrace();
  		    return null;		
	   }	   
   }
}
